<template>
  <Panel tite="商品添加">
    <GoodsForm @success="success"></GoodsForm>
  </Panel>
</template>

<script>
import { goodsAddReq,} from "@/api/goods.api";

import GoodsForm from "./components/GoodsForm.vue";
export default {
  components: {
    GoodsForm,
  },
  data() {
    return {
      cateList: [],
      form: {
        name: "",
        category: "",
        price: "",
        imgUrl: "",
        goodsDesc: "",
      },
    };
  },
  methods: {
    // 商品组件，校验通过
    async success(form) {
      console.log(form);
      const res = await goodsAddReq(form);
      if (res.data.code === 0) {
        this.$message.success("添加商品成功");
        this.$router.push("/goods/list");
      }
    },


    
  },


};
</script>

<style lang="less" scoped>
</style>